<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <button>点击测试</button>
    <script src="./myAxios.js"></script>
    <script>
      const btn = document.querySelector('button')
      btn.addEventListener('click', async function () {
        try {
          const res = await myAxios({
            method: 'GET',
            url: 'http://ajax-api.itheima.net/api/area',
            params: {
              pname: '浙江省',
              cname: '杭州市',
            },
          })
          console.log(res)
        } catch (error) {
          console.log(error)
        }
      })
    </script>
  </body>
</html>
